Skip to content

feat: Add slug to collections and use it in public collection URLs #2301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jan 16, 2025

Conversation

tw4l
Copy link
Member

@tw4l tw4l commented Jan 13, 2025

Resolves #2298

Changes

  • Slugs added to collections, can be specified separately when creating or updating collections or else is based off of supplied collection name
  • Migration added to backfill slugs for existing collections
  • Redirect collection to newest slug if changed
  • Adds option to copy public profile link to "Public Collections" action menu
  • Show "Back to " link instead of breadcrumbs

Manual testing

  1. Log in as crawler
  2. Create or go to a public collection
  3. Click "Copy Link"
  4. Paste link into new tab. Verify collection loads as expected
  5. Click "< Back to ". Verify org profile loads as expected
  6. Click collection from org profile. Verify collection loads as expected
  7. Click pencil icon to edit collection
  8. Update and save new collection name
  9. Repeat 3-4. Verify collection loads with new slug
  10. Go back to previous tab and copy link with old slug
  11. Open new incognito window and paste link with old slug. Verify you're redirected to the newest slug
  12. Go to logged in tab and create a new public collection using the old slug. Verify collection can be created and public view loads as expected

Screenshots

Page Image/video
Dashboard Screenshot 2025-01-13 at 8 33 25 PM
Public collection Screenshot 2025-01-13 at 8 33 43 PM

@SuaYoo SuaYoo force-pushed the public-collections-feature branch from 85053b8 to 56a634e Compare January 13, 2025 23:15
@SuaYoo SuaYoo force-pushed the issue-2298-public-collection-slug branch from 0ae113b to 08939bd Compare January 13, 2025 23:18
Base automatically changed from public-collections-feature to main January 14, 2025 03:32
@SuaYoo SuaYoo force-pushed the issue-2298-public-collection-slug branch 3 times, most recently from 2a32e50 to 32aa0a1 Compare January 14, 2025 05:39
@SuaYoo SuaYoo marked this pull request as ready for review January 14, 2025 05:40
@SuaYoo
Copy link
Member

SuaYoo commented Jan 14, 2025

@tw4l tested backend locally, looks good--frontend ready for review

@SuaYoo SuaYoo changed the title Add slug to collections and use it in public collection URLs feat: Add slug to collections and use it in public collection URLs Jan 14, 2025
@tw4l tw4l force-pushed the issue-2298-public-collection-slug branch 2 times, most recently from 0d5dc3b to 547f37c Compare January 14, 2025 16:01
@tw4l tw4l force-pushed the issue-2298-public-collection-slug branch from 547f37c to 943f91b Compare January 14, 2025 19:35
@SuaYoo SuaYoo requested a review from ikreymer January 14, 2025 20:56
@ikreymer
Copy link
Member

ikreymer commented Jan 16, 2025

The collection loads under the old slug, but the URL is not redirect, still has the old slug. Verified the API returns the new slug under slug.
Nevermind, didn't have latest!

…an determine if redirect is needed

by comparing the slug in the API request to the 'slug' in the response, and redirect if they're different
@ikreymer ikreymer merged commit 4583bab into main Jan 16, 2025
27 checks passed
@ikreymer ikreymer deleted the issue-2298-public-collection-slug branch January 16, 2025 06:44
ikreymer added a commit that referenced this pull request Jan 21, 2025
Follow-up to #2301 

Updates the 0039 migration to ensure collection slugs and names are
unique by:
- Removing all indexes
- Setting `slug` to random value
- Adding unique index to `slug` field.
- Attempting to set slug from name using `slug_from_name()`
- If rejected due to duplicate, append `-<counter>` at end of slug. Also
update name with ` <counter>`.
- Now that names should also be unique, add unique index on name field.

---------

Co-authored-by: Tessa Walsh <tessa@bitarchivist.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slugify collection name
3 participants